1. Field of the Invention
The present invention relates to object detecting systems, and more particularly, to an object detecting system that detects an object by stereo matching of a pair of images taken by stereo-image taking means.
2. Description of the Related Art
In general, in order to measure the distance to an object with a stereo camera, a pair of images are taken by a pair of right and left cameras that are mounted at the same height, and one of the taken images used for reference (hereinafter referred to as a reference image) is compared with the other image (hereinafter referred to as a comparative image). By comparison, a difference between positions of corresponding portions of the same object in the images, that is, a parallax is calculated, and the distance to the object is calculated from the parallax. The portions in the reference image and the comparative image where an image of the same object is taken are typically located by stereo matching (for example, see Japanese Unexamined Patent Application Publication No. 2004-234423).
In stereo matching, as shown in FIG. 22, a reference image T0 is divided into small regions (hereinafter referred to as reference pixel blocks PB0) defined by a predetermined number of pixels, such as 3 by 3 pixels or 4 by 4 pixels, and a luminance pattern of each reference pixel block PB0 is compared with a luminance pattern of each comparative pixel block PBC, which has the same shape of the reference pixel block PB0, on an epipolar line EPL in a comparative image TC provided corresponding to the reference pixel block PB0.
In this case, for example, when a luminance of each pixel in the reference pixel block PB0 is designated as p1st and a luminance of each pixel in the comparative pixel block PBC is designated as p2st, a SAD (Sum of Absolute Difference) value is calculated as a difference in the luminance pattern according to the following Expression (1):
                              S          ⁢                                          ⁢          A          ⁢                                          ⁢          D                =                              ∑                          s              ,              t                                ⁢                                                                p                ⁢                                                                  ⁢                1                ⁢                st                            -                              p                ⁢                                                                  ⁢                2                ⁢                st                                                                                    (        1        )            
In Expression (1) described above, for example, a SAD value is calculated for all pixels in a region where 1≦s≦3 and 1≦t≦3 when each of the reference pixel block PB0 and the comparative pixel block PBC is set as a region defined by 3 by 3 pixels, and for all pixels in a region where 1≦s≦4 and 1≦t≦4 when each of the reference pixel block PB0 and the comparative pixel block PBC is set as a region defined by 4 by 4 pixels.
A comparative pixel block PBC that provides the smallest SAD value is specified as a comparative pixel block in the comparative image TC that includes an image of the same object as that included in the reference pixel block PB0. Using the result of stereo matching, a parallax between the specified comparative pixel block PBC and the original reference pixel block PB0 is calculated, and the distance to the object is calculated on the basis of the parallax according to the principle of triangulation.
For example, a reference image T0 shown in FIG. 23A and a comparative image TC shown in FIG. 23B are images of the same object O (vehicle), which exists in front of a vehicle in which a stereo camera is mounted, taken by the stereo camera. Consideration will now be taken of stereo matching performed for images of the object O in which similar brightness patterns are thus arranged at regular intervals.
For example, while shifting a comparative pixel block PBC on an epipolar line EPL in the comparative image TC one by one from left to right correspondingly to a reference pixel block PB0(p) set in a portion of the object O in the reference image T0 where the luminance pattern is repeated, SAD value is calculated according to Expression (1) described above. Then, comparative pixel blocks PBC(a), PBC(b), PBC(c), . . . where the SAD value is locally minimized and a downward-pointing peak is provided, sequentially appear, as shown in FIG. 24 serving as a graph.
When a SAD value SAD(c) of the comparative pixel block PBC(c) is less than a SAD value SAD(a) of the comparative pixel block PBC(a) that is supposed to be specified, the comparative pixel block PBC(c) is undesirably specified, in other words, so-called mismatching occurs.
If a parallax is calculated in spite of mismatching, a wrong distance to the object is calculated. For example, although an image of the same object O is taken, as shown in FIGS. 23A and 23B, since a calculated distance to a portion of the object O is wrong, the portion of the object O is erroneously detected as another object Oa having a distance different from the difference to the object O, as shown in FIG. 25.
Such erroneous object detection due to mismatching can occur not only when similar luminance patterns are arranged in a taken image, as shown in FIGS. 23A and 23B, but also when similar luminance patterns are arranged at regular intervals in an image of an object such as a fence or a wall.
For example, if such erroneous object detection occurs in an object detecting system mounted in the vehicle so as to follow a preceding vehicle, particularly when another object is erroneously detected at a position closer than the preceding vehicle, information about the erroneous detection is transmitted to a preceding-vehicle follow-up system in an ECU (Electric Control Unit) of the vehicle, and as a result, unnecessary braking is performed automatically.
In order to solve this problem, the above-described publication discloses a method and system for outputting reliability of a parallax in accordance with the sharpness and distribution condition of the peaks of a SAD value. Unfortunately, much processing time is taken to calculate the reliability of the parallax in this method and system. Moreover, when an object having a luminance pattern in which peaks of the SAD value are easily erroneously specified is detected, as shown in FIGS. 23A and 23B, the total reliability decreases. Therefore, even when the distance calculated on the basis of the parallax is correct, reliability thereof is low, and it is difficult to determine whether the obtained result is correct or wrong.